KREDOR Business Object Framework Documentation

SelectFrom<T> Class

Represents a SELECT query used to select business objects from the database.

For a list of all members of this type, see SelectFrom<T> Members.

System.Object
   SelectFrom<T>

public class SelectFrom<T> where T: DefaultConstructorConstraint, BusinessObject

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Example

This sample demonstrates various ways of using SelectFrom<T> to load collections of objects. Then it shows how to load a collection by calling a stored procedure.

    // Load a collection of persons with first name 'John' sorted by last name.
    List<Contact> contacts = SelectFrom<Contact>.All
                                         .Where("FirstName", Op.Equals, "John")
                                         .OrderBy("LastName")
                                         .Select();

 Load the top ten rock albums for 2005                                     
    List<Album> albums = SelectFrom<Album>.Top(10)
                                        .Where("ReleaseDate" >= DatTime.Parse("1/1/2005"))
                                        .Where("CategoryID", Op.Equal, "Rock")
                                        .OrderBy("Sales", OrderDirection.Descending);
                                        .Select();
    
    // Get the last entered phonenumber for an account
    PhoneNumber p = SelectFrom<PhoneNumber.>.Top(1)
                                            .Where("CrDate", Op.IsMax)
                                            .Where("AccountID", Op.Equals, this._accountID)
                                            .QueryOne();
                                            
    // Load a collection of accounts in California that have orders.
    // NOTE: You need to use a stored procedure when the SELECT statement involves joins.
    List<Account> accountsInCalifornia = SelectFrom<Account>
                                                .StoredProcedure("sp_GetAccountsWithOrders", "CA")
                                                .Select();    
 

Requirements

Namespace: Kredor.BO

Assembly: KREDOR.BOFramework (in KREDOR.BOFramework.dll)

See Also

SelectFrom<T> Members | Kredor.BO Namespace | WhereCondition | OrderBy